<template>
    <el-dialog v-model="visible" @close="closePage" title="流程图" width="60%">
        <div style="max-height:calc(100vh - 250px);overflow: auto;" v-loading="loading">
            <el-image style="width: 100%;" :src="url" />
        </div>
    </el-dialog>
</template>
<script setup>
import { ref } from 'vue';
import { queryBpmnImageReq } from '@/api/workflow/model/index.js'

const visible = ref(false)
// 关闭dialog
const url = ref('')
const loading = ref(false)
const open = (modelId) => {
    url.value = ''
    visible.value = true;
    loading.value = true;
    queryBpmnImageReq(modelId).then(res=>{
        if(res.code == 200){
            url.value = 'data:image/png;base64,' + res.data
        }
    }).finally(() => {
        loading.value = false
    })
}

defineExpose({
    open,
})

const closePage = () => {
    visible.value = false;
}
</script>